package com.woniuxy.main.provider;

import org.apache.ibatis.jdbc.SQL;

import com.woniuxy.main.pojo.Coach;

public class CoachProvider {
	//修改教练信息
	public String coachUpdate(Coach coach){
		SQL sql= new SQL().UPDATE("coach");
		if(coach.getCage()!=0){
			sql.SET("cage="+coach.getCage());
		}
		if(coach.getCsex()!=null && coach.getCsex().length()!=0){
			sql.SET("csex='"+coach.getCsex()+"'");
		}
		if(coach.getCname()!=null && coach.getCname().length()!=0){
			sql.SET("cname='"+coach.getCname()+"'");
		}
		if(coach.getPrice()!=0){
			sql.SET("price="+coach.getPrice());
		}
		if(coach.getStyle()!=null && coach.getStyle().length()!=0){
			sql.SET("style='"+coach.getStyle()+"'");
		}
		//认证
		//默认你的签约状态为未签约
		sql.SET("authentication="+coach.getAuthentication());
		
		if(coach.getCintroduction()!=null && coach.getCintroduction().length()!=0){
			sql.SET("cintroduction='"+coach.getCintroduction()+"'");
		}
		//默认公开信息
		sql.SET("publicLevel="+coach.getPublicLevel());	
		sql.WHERE("uid="+coach.getUid());
		System.out.println("教练的动态sql："+sql.toString());
		return sql.toString();	
	}
	//创建教练信息
	
}
